import http from '@/utils/request'

/**
 * 获取所有权限点
 */
export function reqGetPermissionList() {
  return http({
    method: 'get',
    url: '/sys/permission'
  })
}

/**
 * 添加权限点
 * @param {*} data
 */
export function reqAddPermission(data) {
  return http({
    method: 'post',
    url: '/sys/permission',
    data
  })
}

/**
 * 更新权限
 * @param {*} data
 */
export function reqUpdatePermission(data) {
  return http({
    method: 'put',
    url: `/sys/permission/${data.id}`,
    data
  })
}

/**
 * 删除权限
 * @param {*} id 权限的id
 */
export function reqDelPermission(id) {
  return http({
    method: 'delete',
    url: `/sys/permission/${id}`
  })
}

/**
 * 获取单个权限详情回显
 * @param {*} id 权限的id
 */
export function reqGetPermissionDetail(id) {
  return http({
    method: 'get',
    url: `/sys/permission/${id}`
  })
}
